package cn.xxstudy.visitshop.network

import cn.xxstudy.visitshop.network.data.InfoData
import cn.xxstudy.visitshop.network.data.ResponseData
import cn.xxstudy.visitshop.network.data.ResponseListData
import cn.xxstudy.visitshop.ui.activity.login.model.LoginData
import cn.xxstudy.visitshop.ui.activity.main.fragment.home.model.BannerData
import cn.xxstudy.visitshop.ui.activity.main.fragment.interview.model.InterviewData
import cn.xxstudy.visitshop.ui.activity.main.fragment.train.model.TrainData
import cn.xxstudy.visitshop.ui.activity.main.fragment.visit.model.VisitData
import cn.xxstudy.visitshop.ui.activity.task.model.TaskData
import retrofit2.http.*

/**
 * @author ：DELL on 2021/3/23 .
 * @packages ：cn.xxstudy.visitshop.network .
 * TODO:一句话描述
 */
interface Api {
    @POST("login")
    @FormUrlEncoded
    suspend fun login(
        @Field("nickName") nickName: String,
        @Field("password") password: String
    ): ResponseData<LoginData>

    @GET("announcement")
    suspend fun banner(): ResponseData<ArrayList<BannerData>>

    //任务
    @GET("task")
    suspend fun taskList(
        @Query(value = "page") page: Int = 1,
        @Query(value = "page_size") page_size: Int = 10
    ): ResponseData<ResponseListData<TaskData>>

    //资讯
    @POST("info")
    @FormUrlEncoded
    suspend fun infoList(
        @Field(value = "page") page: Int = 1,
        @Field(value = "page_size") page_size: Int = 10
    ): ResponseData<ResponseListData<InfoData>>

    //巡店历史
    @POST("history")
    @FormUrlEncoded
    suspend fun visitList(
        @Field(value = "userId") userId: String
    ): ResponseData<ResponseListData<VisitData>>

    //巡店历史
    @POST("historyInterview")
    @FormUrlEncoded
    suspend fun interviewList(
        @Field(value = "userId") userId: String
    ): ResponseData<ResponseListData<InterviewData>>

    //培训
    @GET("trainList")
    suspend fun trainList(
        @Query(value = "page") page: Int = 1,
        @Query(value = "page_size") page_size: Int = 8
    ): ResponseData<ResponseListData<TrainData>>

}